package miniBanco.Gui;

import java.util.ArrayList;

import javax.swing.table.AbstractTableModel;
import javax.swing.table.TableModel;

import miniBanco.Dto.*;

@SuppressWarnings("serial") // QUE ES ESTO???
public class ClientesTableModel extends AbstractTableModel implements TableModel 
{
	private ArrayList<ClienteDTO> data;
	private String[] columnNames = {"Numero","RazonSocial","Cuit","Dni"};
	
	public ClientesTableModel(ArrayList<ClienteDTO> dataClientes)
	{
		data = dataClientes;
	}
	
	@Override
	public int getColumnCount() {
		return columnNames.length;
	}

	@Override
	public int getRowCount() {
		return data.size();
	}

	@Override
	public Object getValueAt(int rowIndex, int columnIndex)
	{
		
		ClienteDTO cliente = data.get(rowIndex);
		Object value;
		switch(columnIndex)
		{
			case 0: value = cliente.getNroCliente();break;
			case 1: value = cliente.getRazonSocial();break;
			case 2: value = cliente.getCuit();break;
			case 3: value = cliente.getDni(); break;
			default : value = "nada";break;
		}
		return value;
	}

	@Override
	public String getColumnName(int columnIndex) {
		return columnNames[columnIndex];
	}
	

}
